package com.yuyu.demo.demo_springboot.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;

import com.yuyu.demo.demo_springboot.properties.GirlProperties;
import com.yuyu.demo.demo_springboot.properties.SystemConfig;

@Service
@PropertySource("classpath:/config.properties")
public class PropertyService {

	Logger logger = LoggerFactory.getLogger(PropertyService.class);
	
	@Value("${girl.name:yyyy}")
	private String name;
	
	@Value("${mogodb.url:hhh}")
	private String mogodbUrl;
	
	@Value("${my.secret:hhh}")
	private String mySecret;
	
	@Autowired
	private GirlProperties properties;
	
	public void testProperty(){
		/*logger.info("system=={}",System.getProperty("java.version"));
		logger.info("value=={}",name);
		logger.info("properties=={}",properties.getName());
		logger.info("mogodbUrl=={}",mogodbUrl);
		logger.info("mySecret=={}",mySecret);*/
		
		logger.info(SystemConfig.getProperty("mogodb.url"));
	}
	
}
